home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / m / ieee.man < prev    next >
Encoding:
Text File  |  1989-07-26  |  3.7 KB  |  133 lines

  1.  
  2.  
  3.  
  4. IEEE             Mathematical Library Procedures             IEEE
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      copysign, drem, finite, logb, scalb - copysign, remainder,
  10.      exponent manipulations
  11.  
  12. SSYYNNOOPPSSIISS
  13.      ##iinncclluuddee <<mmaatthh..hh>>
  14.  
  15.      ddoouubbllee ccooppyyssiiggnn((xx,,yy))
  16.      ddoouubbllee xx,,yy;;
  17.  
  18.      ddoouubbllee ddrreemm((xx,,yy))
  19.      ddoouubbllee xx,,yy;;
  20.  
  21.      iinntt ffiinniittee((xx))
  22.      ddoouubbllee xx;;
  23.  
  24.      ddoouubbllee llooggbb((xx))
  25.      ddoouubbllee xx;;
  26.  
  27.      ddoouubbllee ssccaallbb((xx,,nn))
  28.      ddoouubbllee xx;;
  29.      iinntt nn;;
  30.  
  31. DDEESSCCRRIIPPTTIIOONN
  32.      These functions are required for, or recommended by the IEEE
  33.      standard 754 for floating-point arithmetic.
  34.  
  35.      Copysign(x,y) returns x with its sign changed to y's.
  36.  
  37.      Drem(x,y) returns the remainder r := x - n*y where n is the
  38.      integer nearest the exact value of x/y; moreover if
  39.      |n-x/y|=1/2 then n is even.  Consequently the remainder is
  40.      computed exactly and |r| <_ |y|/2.  But drem(x,0) is excep-
  41.      tional; see below under DIAGNOSTICS.
  42.  
  43.      Finite(x) = 1 just when -infinity < x < +infinity,
  44.                = 0 otherwise (when |x| = infinity or x is _N_a_N or
  45.                               x is the VAX's reserved operand.)
  46.  
  47.      Logb(x) returns x's exponent n, a signed integer converted
  48.      to double-precision floating-point and so chosen that
  49.      1 <_ |x|/2**n < 2 unless x = 0 or (only on machines that con-
  50.      form to IEEE 754) |x| = infinity or x lies between 0 and the
  51.      Underflow Threshold; see below under "BUGS".
  52.  
  53.      Scalb(x,n) = x*(2**n) computed, for integer n, without first
  54.      computing 2**n.
  55.  
  56. DDIIAAGGNNOOSSTTIICCSS
  57.      IEEE 754 defines drem(x,0) and drem(infinity,y) to be
  58.      invalid operations that produce a _N_a_N.  On a VAX, drem(x,0)
  59.      returns the reserved operand.  No infinity exists on a VAX.
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 12, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. IEEE             Mathematical Library Procedures             IEEE
  71.  
  72.  
  73.  
  74.      IEEE 754 defines logb(+_infinity) = +infinity and logb(0) =
  75.      -infinity, requires the latter to signal Division-by-Zero.
  76.      But on a VAX, logb(0) = 1.0 - 2.0**31 = -2,147,483,647.0.
  77.      And if the correct value of scalb(x,n) would overflow on a
  78.      VAX, it returns the reserved operand and sets _e_r_r_n_o to
  79.      ERANGE.
  80.  
  81. SSEEEE AALLSSOO
  82.      floor(3M), math(3M), infnan(3M)
  83.  
  84. AAUUTTHHOORR
  85.      Kwok-Choi Ng
  86.  
  87. BBUUGGSS
  88.      Should drem(x,0) and logb(0) on a VAX signal invalidity by
  89.      setting _e_r_r_n_o = EDOM?  Should  logb(0) return  -1.7e38?
  90.  
  91.      IEEE 754 currently specifies that logb(denormalized no.) =
  92.      logb(tiniest normalized no. > 0) but the consensus has
  93.      changed to the specification in the new proposed IEEE stan-
  94.      dard p854, namely that logb(x) satisfy
  95.           1 <_ scalb(|x|,-logb(x)) < Radix   ... = 2 for IEEE 754
  96.      for every x except 0, infinity and _N_a_N.  Almost every pro-
  97.      gram that assumes 754's specification will work correctly if
  98.      logb follows 854's specification instead.
  99.  
  100.      IEEE 754 requires copysign(x,_N_a_N) = +_x  but says nothing
  101.      else about the sign of a _N_a_N.  A _N_a_N (_Not _a _Number) is simi-
  102.      lar in spirit to the VAX's reserved operand, but very dif-
  103.      ferent in important details.  Since the sign bit of a
  104.      reserved operand makes it look negative,
  105.           copysign(x,reserved operand) = -x;
  106.      should this return the reserved operand instead?
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 12, 1986                          2
  130.  
  131.  
  132.  
  133.